package de.szut.sudoku.gui;

import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import java.awt.Font;

/**
 * Frame that shows a celebration message that's supposed to make the user feel
 * better about wasting his life
 * 
 * @author dqi12huisinga
 * 
 */
@SuppressWarnings("serial")
public class GameEndedFrame extends JFrame {

	private JPanel contentPane;
	private JLabel lblCongrats;
	private JLabel lblYouWonThe;

	/**
	 * Generates the celebration frame
	 */
	public GameEndedFrame() {
		setResizable(false);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);

		lblCongrats = new JLabel("Congrats!");
		lblCongrats.setFont(new Font("Tahoma", Font.PLAIN, 20));
		lblCongrats.setHorizontalAlignment(SwingConstants.CENTER);
		contentPane.add(lblCongrats, BorderLayout.NORTH);

		lblYouWonThe = new JLabel(
				"<html>"
						+ "<b> You won the game and completed the sudoku-puzzle! </b> <br>"
						+ "Time taken in this session: "
						+ "<i>"
						+ MainFrame.getInstance().getSudokuPanel()
								.getCurrentSudokuTime() + "</i>" + "</html>");
		lblYouWonThe.setHorizontalAlignment(SwingConstants.CENTER);
		contentPane.add(lblYouWonThe, BorderLayout.CENTER);
		pack();
		setVisible(true);
	}

}
